<?php

namespace App\Model\Spread;

use Hyperf\DbConnection\Model\Model;

class SpreadLog extends Model
{
    protected $connection = 'spread';
    protected $table = 'spread_log';

    protected $guarded =[];

    public function getTotalCountBySid($sid,$startDate,$endDate): int
    {
        return self::where('s_id',$sid)->where('is_activate',1)->where([
            ['updated_at','>=',$startDate],
            ['updated_at','<=',$endDate],
        ])->count() ?? 0;
    }
}